# ~*~ coding: utf-8 ~*~
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import InputRequired

from apps.common.form import ErrorFormMinx

__all__ = ['ScriptForm']


class ScriptForm(ErrorFormMinx, FlaskForm):
    name = StringField(validators=[InputRequired(message="脚本名称不能为空")])
    language = StringField()
    content = StringField()

    @property
    def data(self):
        return {
            'name': self.name.data,
            'language': self.language.data,
            'content': self.content.data,
        }
